/*
 * swapper.h
 */

#ifndef SWAPPER_H_
#define SWAPPER_H_

//Swap threshold, % of free memory (1-99):
#define MEM_T 97

// proc.c:
void swapper(void);
int swap_out(struct proc* pid, int fd);
int swap_in(struct proc* pid);
struct proc* selectSwapProc();

// kalloc.c:
int get_free_percent();
int swapNeeded();

// swaputils.c:
void getFileName(int pid, char* result);
int createSwapFile(int pid, struct proc* p, int mode);
void closeSwapFile(int filedesc, struct proc *p);

// vm.c:
int toFile(struct file*, struct proc* p);
int fromFile(struct file*, struct proc* p);


#endif /* SWAPPER_H_ */
